﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace Tradex.Messages {
    
    /// <summary>
    /// The ConnectionUpdateMessage informs listeners of an update on a connetion.
    /// </summary>
    [Serializable()]
    public class ConnectionUpdateMessage : Message {

        /// <summary>
        /// Public Constructor taking all values.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="info"></param>
        /// <param name="update"></param>
        /// <param name="status"></param>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
        public ConnectionUpdateMessage(
            ConnectionKey key,
            ConnectionInfo info = null,
            ConnectionUpdate update = null,
            ConnectionStatus status = null
        ) {
            Key = key;
            Info = info;
            Update = update;
            Status = status;
        }

        /// <inheritdoc />
        public override MessageCode Code { get { return MessageCode.ConnectionUpdate; } }

        /// <summary>
        /// Gets the ConnectionKey.
        /// </summary>
        public ConnectionKey Key { get; private set; }

        /// <summary>
        /// Gets the ConnectionInfo.
        /// </summary>
        public ConnectionInfo Info { get; private set; }

        /// <summary>
        /// Gets the ConnectionUpdate.
        /// </summary>
        public ConnectionUpdate Update { get; private set; }

        /// <summary>
        /// Gets the ConnectionStatus.
        /// </summary>
        public ConnectionStatus Status { get; private set; }

    }

}
